﻿namespace Events;

public class EmailPriceChangeNotifier:IObserver<decimal>
{
    private readonly decimal _notificationThreshold;

    public EmailPriceChangeNotifier(decimal notificationThreshold)
    {
        _notificationThreshold = notificationThreshold;
    }

    public void Update(decimal price)
    {
        if (price > _notificationThreshold)
        {
            Console.WriteLine(
                $"Sending an email saying that" +
                $"the gold price exceeded {_notificationThreshold}" +
                $"and is now {price}\n");
        }
    }
}